package com.yehaikeji.workflow.service.serviceImpl;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yehaikeji.workflow.bean.unit;
import com.yehaikeji.workflow.mapper.unitMapper;
import com.yehaikeji.workflow.service.unitService;

@Service
public class unitServiceImpl implements unitService {
	
	@Autowired
	private unitMapper unitMapper;
	
	@Override
	public String insertunit(unit unit) {
		unit.setCreatedate(new Date());
		String unitid=UUID.randomUUID().toString().replaceAll("-", "");
		unit.setUnitid(unitid);
		unitMapper.insertSelective(unit);
		return unitid;
	}
	
	@Override
	public int deleteunit(String unitid) {
		
		return unitMapper.deleteByPrimaryKey(unitid);
	}

	@Override
	public List<unit> selectunitall(Integer type) {
		
		return unitMapper.selectunitall(type);
	}

}
